
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <title>图书管理系统</title>
    <style>
        table { width: 80%; border-collapse: collapse; margin: 20px auto; }
        th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
        th { background-color: #f2f2f2; }
        form { width: 80%; margin: 20px auto; }
        input[type=text] { padding: 8px; width: 200px; }
        button { padding: 8px 16px; }
    </style>
</head>
<body>
    <h1 style="text-align: center;">图书管理系统</h1>
    
    <form method="post" action="books">
        <input type="text" name="title" placeholder="书名" required>
        <input type="text" name="author" placeholder="作者" required>
        <button type="submit">添加图书</button>
    </form>
    
    <table>
        <tr>
            <th>ID</th>
            <th>书名</th>
            <th>作者</th>
        </tr>
        <c:forEach items="${books}" var="book">
            <tr>
                <td>${book.id}</td>
                <td>${book.title}</td>
                <td>${book.author}</td>
            </tr>
        </c:forEach>
    </table>
</body>
</html>
